/*
*  Copyright (c) 2010-2023
*/
package net.siufung.market.base.uuid.controller.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import net.siufung.core.model.enums.DeletedEnum;
import net.siufung.core.utils.StringPool;
import org.hibernate.validator.constraints.Length;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.uuid.mapper.entity.SysUuid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.siufung.core.model.AbstractVo;
import net.siufung.core.model.AbstractDto;
import net.siufung.core.page.PagerDto;
/**
* 流水号表 模型
*
* @author 陈建峰
* @since 2023-10-09 22:16:17
*/
public class SysUuidModel {

    @Data
    @ApiModel(value="SysUuidDto", description="流水号表默认传参对象")
    public static class Dto implements Serializable {

        private static final long serialVersionUID = 1711385138270720000L;
        /**
         * 主键id
         */
        @ApiModelProperty(value = "主键id")
        private Integer id;
        /**
         * 规则名称
         */
        @ApiModelProperty(value = "规则名称")
        private String uuidName;
        /**
         * 规则编码
         */
        @ApiModelProperty(value = "规则编码")
        private String uuidCode;
        /**
         * 默认标识
         */
        @ApiModelProperty(value = "默认标识")
        private Boolean defaultFlag;
        /**
         * 描述
         */
        @ApiModelProperty(value = "描述")
        private String description;

        /**
         * 转化成数据库实体
         * @return SysUuid
         */
        public SysUuid to(){
            SysUuid sysUuid = new SysUuid();
            CopyUtil.copyProperties(this, sysUuid);
            return sysUuid;
        }
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel(value="SysUuidPageDto", description="流水号表分页传参对象")
    public static class PageDto extends PagerDto {

        /**
         * 默认标识
         */
        @ApiModelProperty(value = "默认标识")
        private Boolean defaultFlag;
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel(value="SysUuidSaveDto", description="流水号表创建传参对象")
    public static class SaveDto extends AbstractDto {

        private static final long serialVersionUID = 1L;

        /**
         * 规则名称
         */
        @ApiModelProperty(value = "规则名称", required = true)
        @Length(max=32, message="规则名称长度不大于32!")
        @NotBlank(message = "规则名称不能为空!")
        private String uuidName;

        /**
         * 规则编码
         */
        @ApiModelProperty(value = "规则编码")
        @Length(max=32, message="规则编码长度不大于32!")
        private String uuidCode;

        /**
         * 默认标识
         */
        @ApiModelProperty(value = "默认标识", required = true)
        @NotNull(message = "默认标识不能为空!")
        private Boolean defaultFlag;

        /**
         * 描述
         */
        @ApiModelProperty(value = "描述")
        @Length(max=255, message="描述长度不大于255!")
        private String description;

        public SysUuid to(){
            SysUuid sysUuid = new SysUuid();
            CopyUtil.copyProperties(this, sysUuid);
            return sysUuid;
        }
    }


    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel(value="SysUuidUpdateDto", description="流水号表更新传参对象")
    public static class UpdateDto extends AbstractDto {

        private static final long serialVersionUID = 1L;

        /**
         * 主键id
         */
        @ApiModelProperty(value = "主键id", required = true)
        @NotNull(message = "主键id不能为空!")
        private Integer id;

        /**
         * 规则名称
         */
        @ApiModelProperty(value = "规则名称", required = true)
        @NotBlank(message = "规则名称不能为空!")
        @Length(max=32, message="规则名称长度不大于32!")
        private String uuidName;

        /**
         * 规则编码
         */
        @ApiModelProperty(value = "规则编码")
        @Length(max=32, message="规则编码长度不大于32!")
        private String uuidCode;

        /**
         * 默认标识
         */
        @ApiModelProperty(value = "默认标识", required = true)
        @NotNull(message = "默认标识不能为空!")
        private Boolean defaultFlag;

        /**
         * 描述
         */
        @ApiModelProperty(value = "描述")
        @Length(max=255, message="描述长度不大于255!")
        private String description;

        public SysUuid to(){
            SysUuid sysUuid = new SysUuid();
            CopyUtil.copyProperties(this, sysUuid);
            return sysUuid;
        }
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel(value="SysUuidVo", description="流水号表")
    public static class Vo extends AbstractVo {

        private static final long serialVersionUID = 1L;
        /**
         * 主键id
         */
        @ApiModelProperty(value = "主键id")
        private Integer id;
        /**
         * 规则名称
         */
        @ApiModelProperty(value = "规则名称")
        private String uuidName;
        /**
         * 规则编码
         */
        @ApiModelProperty(value = "规则编码")
        private String uuidCode;
        /**
         * 默认标识
         */
        @ApiModelProperty(value = "默认标识")
        private Boolean defaultFlag;
        /**
         * 描述
         */
        @ApiModelProperty(value = "描述")
        private String description;
        /**
         * 创建人
         */
        @ApiModelProperty(value = "创建人")
        private String createdBy;
        /**
         * 创建时间
         */
        @ApiModelProperty(value = "创建时间")
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private LocalDateTime createdAt;
        /**
         * 更新人
         */
        @ApiModelProperty(value = "更新人")
        private String updatedBy;
        /**
         * 更新时间
         */
        @ApiModelProperty(value = "更新时间")
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private LocalDateTime updatedAt;
        /**
         * 数据标识
         */
        @ApiModelProperty(value = "数据标识")
        private Boolean deleted;



        public String getDefaultFlagDesc() {
            // 扩展开发
            return StringPool.EMPTY;
        }








        @Override
        public String getDeletedDesc() {
            return DeletedEnum.getDesc(deleted);
        }

        @Override
        public boolean getAllowRemove() {
            return DeletedEnum.NOT.equals(DeletedEnum.get(deleted));
        }

        @Override
        public boolean getAllowUpdate() {
            return DeletedEnum.NOT.equals(DeletedEnum.get(deleted));
        }
    }

}